package com.cloudbroker.openapi.manage.controller;

import com.cloudbroker.bcs.common.util.VOUtil;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.msg.back.MsgCombineDetailBack;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.msg.back.MsgCombineDetailListBack;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.msg.back.MsgDetailListBack;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.msg.back.MsgIndexBack;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.msg.vo.MsgCombineDetailForm;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.msg.vo.MsgCombineDetailListForm;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.msg.vo.MsgDetailListForm;
import com.cloudbroker.bcs.platform.ltb.bizapi.service.msg.vo.MsgIndexForm;
import com.cloudbroker.bcs.platform.ltb.bizapi.t2service.business.MsgT2BizService;
import com.cloudbroker.bcs.platform.ltb.common.ext.annotation.SaveLog;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

import static com.cloudbroker.bcs.platform.ltb.common.util.RequestUtil.getSingleParameterMapForBody;

/**
 * Created by daibd19671 on 2016/12/28.
 */
@Controller
public class MsgController {
    @Resource
    private MsgT2BizService msgT2BizService;

    @ResponseBody
    @RequestMapping(value="/msg_index")
    @SaveLog(remark = "消息主页")
    public MsgIndexBack func_msg_index(HttpServletRequest request, String jsonpcallBack){
        MsgIndexForm form = getSingleParameterMapForBody(request,MsgIndexForm.class);
        return VOUtil.setJsonpResult(msgT2BizService.func_msg_index(form),jsonpcallBack);
    }

    @ResponseBody
    @RequestMapping(value="/msg_detail_list")
    @SaveLog(remark = "消息详情列表")
    public MsgDetailListBack func_msg_detail_list(HttpServletRequest request, String jsonpcallBack){
        MsgDetailListForm form = getSingleParameterMapForBody(request,MsgDetailListForm.class);
        return VOUtil.setJsonpResult(msgT2BizService.func_msg_detail_list(form),jsonpcallBack);
    }

    @ResponseBody
    @RequestMapping(value="/msg_combine_list")
    @SaveLog(remark = "组合调仓消息列表")
    public MsgCombineDetailListBack func_msg_combine_list(HttpServletRequest request, String jsonpcallBack){
        MsgCombineDetailListForm form = getSingleParameterMapForBody(request,MsgCombineDetailListForm.class);
        return VOUtil.setJsonpResult(msgT2BizService.func_msg_combine_list(form),jsonpcallBack);
    }

    @ResponseBody
    @RequestMapping(value="/msg_combine_detail")
    @SaveLog(remark = "组合调仓消息详情")
    public MsgCombineDetailBack func_msg_combine_detail(HttpServletRequest request, String jsonpcallBack){
        MsgCombineDetailForm form = getSingleParameterMapForBody(request,MsgCombineDetailForm.class);
        return VOUtil.setJsonpResult(msgT2BizService.func_msg_combine_detail(form),jsonpcallBack);
    }
}
